#include "cpp_startup.hpp"
#include <stdio.h>
#include <string.h>


void cpp_startup(void)
{
    Cat a((char *)"a",12);
    Cat b((char *)"b",20);
    
    a.show();
    b.show();
    
    a = b;
    
    a.show();
    b.show();
}


Cat &Cat::operator=(Cat &other)
{
    this->m_age = other.m_age;
    strcpy(this->m_name,other.m_name);
}


Cat::Cat(char *name,int age):m_age(age)
{
    strcpy(this->m_name,name);
#ifdef CRLF
    printf("cat %s has been created"CRLF,this->m_name);
#else
    printf("cat %s has been created"LF,this->m_name);
#endif
}


Cat::~Cat()
{
#ifdef CRLF
    printf("cat %s has been destroy"CRLF,this->m_name);
#else
    printf("cat %s has been destroy"LF,this->m_name);
#endif
}


void Cat::show(void)
{
#ifdef CRLF
    printf("name of cat is %s"CRLF,this->m_name);
    printf("age of cat is %d"CRLF,this->m_age);
#else
    printf("name of cat is %s"LF,this->m_name);
    printf("age of cat is %d"LF,this->m_age);
#endif
}

